# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Peter Shkenev <santurysim@gmail.com>
pkgname=py3-mimeparse
_pkgname=python-mimeparse
pkgver=1.6.0
pkgrel=9
pkgdesc="Basic functions for parsing mime-types and matching media-ranges"
url="https://github.com/falconry/python-mimeparse"
arch="noarch"
license="MIT"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/falconry/python-mimeparse/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-mimeparse" # Backwards compatibility
provides="py-mimeparse=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 mimeparse_test.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
31752e6019be3a766fa429d27eab071bb77e1c812e6a241d8b84838eda206549877fb3369200338a603d4d93fbbbaaa16f6cf47391aeac65675fd271a5f39259  py3-mimeparse-1.6.0.tar.gz
"
